// Copyright 2007-2009 Stuart Caborn, Alex Scordellis
//  
//  Licensed under the Apache License, Version 2.0 (the "License"); 
//  http://www.apache.org/licenses/LICENSE-2.0

using System;

namespace SampleApp.Monitored
{
    public interface IGenericInterface<T>
    {
        T Load();

        string Describe();
    }

    public class GenericImplementation<T> : IGenericInterface<T> where T : new()
    {
        public T Load() { return new T();}
        public string Describe() { return "description"; }
    }

    public interface IMonitoredClass
    {
        void MethodA();
        string PropertyA { get; }
        void GenericMethodA<T>();
        void ThrowNotImplementedException();
    }

    public static class MonitoredImplementationFactory
    {
        public static IMonitoredClass Instance
        {
            get { return new ProductionClassNotUsedByAnyone(); }
        }
    }

    public abstract class MonitoredBase : IMonitoredClass
    {
        #region IMonitoredClass Members

        public abstract void MethodA();
        public abstract string PropertyA { get; }
        public abstract void GenericMethodA<T>();

        #endregion

        public abstract void ThrowNotImplementedException();
    }

    public class MonitoredImplementationA : MonitoredBase
    {
        public override void MethodA()
        {
        }

        public override string PropertyA
        {
            get { return "PropertyA-called"; }
        }

        public override void GenericMethodA<T>() { }
        public override void ThrowNotImplementedException()
        {
            throw new NotImplementedException("message!", new InsufficientMemoryException());
        }
    }

    public class MonitoredImplementationB : IMonitoredClass
    {
        #region IMonitoredClass Members

        public void MethodA()
        {
        }

        public string PropertyA
        {
            get { return "Property a called"; }
        }

        public void GenericMethodA<T>() { }
        public void ThrowNotImplementedException() { throw new System.NotImplementedException(); }

        #endregion
    }
}